﻿@{    
    //page title
    ViewBag.Title = T("Admin.Configuration.Shipping.Warehouses").Text;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-configuration.png")" alt="" />
        @T("Admin.Configuration.Shipping.Warehouses")
    </div>
    <div class="options">
        <a href="@Url.Action("CreateWarehouse")" class="k-button">@T("Admin.Common.AddNew")</a>
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            <div id="warehouse-grid"></div>

            <script>
                $(document).ready(function () {
                    $("#warehouse-grid").kendoGrid({
                        dataSource: {
                            type: "json",
                            transport: {
                                read: {
                                    url: "@Html.Raw(Url.Action("Warehouses", "Shipping"))",
                                    type: "POST",
                                    dataType: "json"
                                }
                            },
                            schema: {
                                data: "Data",
                                total: "Total",
                                errors: "Errors"
                            },
                            error: function(e) {
                                display_kendoui_grid_error(e);
                                // Cancel the changes
                                this.cancelChanges();
                            },
                            serverPaging: true,
                            serverFiltering: true,
                            serverSorting: true
                        },
                        pageable: {
                            refresh: true,
                            numeric: false,
                            previousNext: false,
                            info: false
                        },
                        editable: {
                            confirmation: false,
                            mode: "inline"
                        },
                        scrollable: false,
                        columns: [{
                            field: "Name",
                            title: "@T("Admin.Configuration.Shipping.Warehouses.Fields.Name")"
                        }, {
                            field: "Id",
                            title: "@T("Admin.Common.Edit")",
                            width: 100,
                            template: '<a href="EditWarehouse/#=Id#">@T("Admin.Common.Edit")</a>'
                        }]
                    });
                });
            </script>
        </td>
    </tr>
</table>
